const express = require('express');
const app = express();

app.use(express.json());

// 支付回调接口
app.post('/callback', (req, res) => {
  console.log('收到支付回调:', req.body);
  // 这里写你的业务逻辑，比如订单状态更新等
  res.send('ok');
});

// 测试根路径
app.get('/', (req, res) => {
  res.send('Hello Douyin Cloud!');
});

// 端口适配抖音云开发平台，必须监听 process.env.PORT，默认 8000
const port = process.env.PORT || 8000;
app.listen(port, () => {
  console.log('Server running on port', port);
});